package com.wechat.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wechat.admin.model.dto.CurrentUserInfoDto;
import com.wechat.admin.model.dto.UserInfoByGroupDto;
import com.wechat.admin.model.dto.UserInfoDto;
import com.wechat.admin.model.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* @author dell
* @description 针对表【user】的数据库操作Mapper
* @createDate 2024-12-14 16:55:06
* @Entity com.wechat.admin.model.entity.User
*/
@Mapper
public interface UserMapper extends BaseMapper<User> {


    CurrentUserInfoDto getLoginUserByUserName(@Param("username") String username);

    /**
     * 用户表分页查询某个组下的所有用户信息
     * @param groupId
     * @param pageSize
     * @param offset
     * @return
     */
    List<UserInfoDto> selectUsersByGroupId(@Param("groupId") Integer groupId,
                                    @Param("pageSize") int pageSize,
                                    @Param("offset") int offset);

    List<UserInfoDto> selectAllUsers(@Param("pageSize") int pageSize,
                                           @Param("offset") int offset);

    /**
     * 按照组查询所有用户信息
     * @return
     */
    List<UserInfoByGroupDto> selectUsersWithGroup();

    /**
     * 所有被分组用户记录数
     * @return
     */
    long countUsers();

    long countUsersByGroupId(@Param("groupId") Integer groupId);

    long testUpdateAllTable();

}




